package CH6;

/**
 * Created by Cai Ye on 2016/4/9.
 */

import static java.lang.System.out;

public class ThreadJoinDemo {
    public static void main(String[] args) throws InterruptedException {
        out.println("Main thread 开始……");
        Thread threadB = new Thread(() -> {
            out.println("Thread B 开始……");
            for (int i = 0; i < 5; i++) {
                out.println("Thread B 执行……");
            }
            out.println("Thread B 将结束……");
        });
        threadB.start();
        threadB.join();
        out.println("Main thread 将结束……");
    }
}
